Added support for server side row model to enable server side row grouping, similar to infinite row model#411
Added support for server side row model to enable server side row grouping, similar to infinite row model#411anujdhillxn wants to merge 3 commits intoplotly:mainfrom
Conversation
|
Fixes #410 |
|
Thanks for the PR @anujdhillxn - please edit the description to give us an idea of what problem this solves and how you've gone about tackling it so that I can find a reviewer. |
|
Hi @gvwilson. Thanks for the response. I have edited the PR title and the attached issue to be more descriptive. |
|
I am open to this, however, can you provide some more types of tests. For example, we need to have grouping (this is what you have), filters and sorting, just like how we have it in the infinite model. We had initially avoided this due to complexity and the logic behind setting it up, also had issues with creating the payload to the dash server for the necessary details. Also, there is a way to setup the endpoint that has been documented: This example demonstrates how to set it up for the grid, my concern with just having the request that you might lose data that is beneficial to the query. |
|
Hi @anujdhillxn, |
| }; | ||
| }, [getRowsParams.current, customSetProps]); | ||
|
|
||
| const getServerSideDatasource = useCallback(() => { |
There was a problem hiding this comment.
getRowsRequest change detection (serverSide model)
In the serverSide row model you do:
customSetProps({
getRowsRequest: params.request,
});Dash only triggers callbacks when an Input prop changes (deep equality check).
If the grid is unmounted and later remounted (e.g. inside a modal), the first SSRM request after remount is often identical to the previous one (startRow, endRow, sortModel, etc.). Since we send only params.request, Dash sees it as deep-equal to the previous value and does not trigger the callback.
Result: the grid remains stuck in loading state because no backend getRows callback fires.
This does not occur with the infinite model because it sends a different object shape that typically changes between calls.
Suggested fix
Force the prop to always change, e.g.:
getRows(params) {
getRowsParams.current = params;
customSetProps({
getRowsRequest: {
...params.request,
__dash_ts: Date.now(), // ensure Dash detects change
},
});
}Optionally also clear props in destroy():
destroy() {
getRowsParams.current = null;
customSetProps({
getRowsRequest: null,
getRowsResponse: null,
});
}This prevents equality-based suppression of the Dash callback and avoids the stuck loading issue after remount.
No description provided.